﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace MvcArchStarter.Core.Persistence
{
    public interface IRepository<TEntity> where TEntity : class
    {
        IQueryable<TEntity> FindAll();
        IQueryable<TEntity> FindWhere(Expression<Func<TEntity, bool>> predicate);

        /// <summary>
        /// Includes the specified path
        /// </summary>
        /// <param name="pathExpression">Expression that contains path to include</param>
        /// <returns></returns>
        IRepository<TEntity> Include(Expression<Func<TEntity, object>> pathExpression);
        IRepository<TEntity> Include(string path);

        /// <summary>
        /// Add an instance of entity to DbContext, for persistence later.  To persist an Added object
        /// use with IUnitOfWork.SaveChanges()
        /// </summary>
        /// <param name="entity"></param>
        void Add(TEntity entity);
        void Remove(TEntity entity);
    }
}
